*/
function loadTheme() {
let themeContext = St.ThemeContext.get_for_stage (global.stage);
+ let previousTheme = themeContext.get_theme();
let cssStylesheet = _defaultCssStylesheet;
if (_cssStylesheet != null)
cssStylesheet = _cssStylesheet;
let theme = new St.Theme ({ application_stylesheet: cssStylesheet });
+
+ if (previousTheme) {
+ let customStylesheets = previousTheme.get_custom_stylesheets();
+
+ for (let i = 0; i < customStylesheets.length; i++)
+ theme.load_stylesheet(customStylesheets[i]);
+ }
+
themeContext.set_theme (theme);
}
cr_stylesheet_unref (stylesheet);
}
+/**
+ * st_theme_get_custom_stylesheets:
+ * @theme: an #StTheme
+ *
+ * Returns: (transfer full) (element-type utf8): the list of stylesheet filenames
+ * that were loaded with st_theme_load_stylesheet()
+ */
+GSList*
+st_theme_get_custom_stylesheets (StTheme *theme)
+{
+ GSList *result = NULL;
+ GSList *iter;
+
+ for (iter = theme->custom_stylesheets; iter; iter = iter->next)
+ {
+ CRStyleSheet *stylesheet = iter->data;
+ gchar *filename = g_hash_table_lookup (theme->filenames_by_stylesheet, stylesheet);
+
+ result = g_slist_prepend (result, g_strdup (filename));
+ }
+
+ return result;
+}
+
static GObject *
st_theme_constructor (GType type,
guint n_construct_properties,
const char *theme_stylesheet,
const char *default_stylesheet);
-gboolean st_theme_load_stylesheet (StTheme *theme, const char *path, GError **error);
-
-void st_theme_unload_stylesheet (StTheme *theme, const char *path);
+gboolean st_theme_load_stylesheet (StTheme *theme, const char *path, GError **error);
+void st_theme_unload_stylesheet (StTheme *theme, const char *path);
+GSList *st_theme_get_custom_stylesheets (StTheme *theme);
G_END_DECLS